{{ define "title" }}{{ .Site.Title }}{{ end }}

{{ define "main" }}

{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
<script src="{{ $enquire.RelPermalink }}"></script>

<main class="{{ if $.Param "enableSidebar" }}main-main{{ else }}main{{ end }}">
    <article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
        <div class="content">
            {{ .Content }}
        </div>
    </article>

    <div class="summary__container">
        {{ $paginator := .Paginate (where (where (where .Site.RegularPages "Type" "!=" "contact") "Type" "!=" "archive") "Type" "!=" "about") }}
        {{ range $paginator.Pages }}
        {{ .Render "summary" }}
        {{ end }}
    </div>    {{ partial "pagination/pagination" . }}
</main>

{{ if $.Param "enableSidebar" }}
    <aside class="main-side">
        {{ partial "sidebar/sidebar-home" . }}
    </aside>
{{ end }}
<script>
    enquire.register("screen and (max-width: 769px)", {
        match: function () {
            if (document.getElementsByTagName('main')[0]) {
                document.getElementsByTagName('main')[0].className = "main";
            }
            if (document.getElementsByTagName('aside')[0]) {
                document.getElementsByTagName('aside')[0].className = "hide";
            }
        },
        unmatch: function () {
            if (document.getElementsByTagName('main')[0]) {
                document.getElementsByTagName('main')[0].className = "main-main";
            }
            if (document.getElementsByTagName('aside')[0]) {
                document.getElementsByTagName('aside')[0].className = "main-side";
            }
            document.getElementsByClassName('navbar__burger')[0].classList.remove('is-active');
            document.getElementsByClassName('navbar__menu')[0].classList.remove('is-active');
            document.getElementsByClassName('mobile-search')[0].classList.add('hide');
        },
        setup: function () { },
        deferSetup: true,
        destroy: function () { },
    });
</script>
{{ partial "script/home-script" . }}
{{ end }}